<!DOCTYPE html>
<html>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_data_tables.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:01 GMT -->

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>订单信息</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/dist/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/switchery/switchery.css" rel="stylesheet">
    <!-- Data Tables -->
    <link href="__PUBLIC__/dist/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/dist/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link rel="stylesheet" href="__PUBLIC__/dist/css/bootstrap-select.css">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>{$info ? '编辑' : '新增'}订单信息</h5>
                    </div>
                    <div class="ibox-content">
                        <form id="myform" role="form" class="form-horizontal m-t" method="post">
                            <div class="panel blank-panel">
                                <div class="panel-heading">
                                    <div class="panel-options">
                                        <ul class="nav nav-tabs">
                                            <li class="active">
                                                <a data-toggle="tab" href="tabs_panels.html#tab-1" aria-expanded="false">
                                                    订单
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="panel-body">
                                    <div class="tab-content">
                                        <div id="tab-1" class="tab-pane active">
                                            {if condition="$businesses_id eq 0"}
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">所属商家：</label>
                                                <div class="col-sm-6">
                                                    <select id="businesses_id" name="businesses_id" class="form-control" required>
                                                        {foreach name="businesses" item="item"}
                                                        {if condition="$item['id'] eq $info['businesses_id']"}
                                                        <option value="{$item.id}" selected="selected">
                                                            {$item.name}
                                                        </option>
                                                        {else/}
                                                        <option value="{$item.id}">
                                                            {$item.name}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            {else/}
                                            <input type="hidden" name="businesses_id" value="{$businesses_id}">
                                            {/if}
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">订单编号：</label>
                                                <div class="col-sm-6">
                                                    <input type="hidden" name="nature_id" value="0">
                                                    <input type="text" class="form-control" id="order_no" name="order_no"
                                                        value="{$order_no}" placeholder="请输入订单编号" required>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">车辆型号：</label>
                                                <div class="col-sm-6">
                                                    <input type="text" class="form-control" id="car_mode_name" name="car_mode_name"
                                                        value="{$info.car_mode_name}" placeholder="车辆型号" disabled="disabled">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">车牌号：</label>
                                                <div class="col-sm-6">
                                                    <select id="car_id" name="car_id" class="selectpicker show-tick form-control" data-live-search="true" required>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">所属网点：</label>
                                                <div class="col-sm-6">
                                                    <select id="store_id" name="store_id" class="form-control" required>
                                                        {foreach name="stores" item="item"}
                                                        {if condition="$item['id'] eq $info['store_id']"}
                                                        <option value="{$item.id}" selected="selected">
                                                            {$item.name}
                                                        </option>
                                                        {else/}
                                                        <option value="{$item.id}">
                                                            {$item.name}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">签单人：</label>
                                                <div class="col-sm-6">
                                                    <input type="text" class="form-control" id="signer_name" name="signer_name"
                                                        value="{$info.signer_name}" placeholder="请输入签单人" required>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">客户名称：</label>
                                                <div class="col-sm-6">
                                                    <select id="customer_id" name="customer_id" class="selectpicker show-tick form-control" data-live-search="true" required>
                                                        {foreach name="customers" item="item"}
                                                        {if condition="$item['id'] eq $info['customer_id']"}
                                                        <option value="{$item.id}" data-master="{$item.master_name}"
                                                            data-tel="{$item.tel}" selected="selected">
                                                            {$item.real_name}
                                                        </option>
                                                        {else/}
                                                        <option value="{$item.id}" data-master="{$item.master_name}"
                                                            data-tel="{$item.tel}">
                                                            {$item.real_name}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">联系人：</label>
                                                <div class="col-sm-6">
                                                    <input type="text" class="form-control" id="contactor_name" name="contactor_name"
                                                        readonly="readonly" value="{$info.contactor_name}" placeholder="请输入联系人">
                                                    <input type="hidden" name="contactor_id" value="0">
                                                    <!-- <select id="contactor_id" name="contactor_id" class="form-control" required>
                                                    </select> -->
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">联系方式：</label>
                                                <div class="col-sm-6">
                                                    <input type="text" class="form-control" id="tel" name="tel"
                                                        readonly="readonly" value="{$info.tel}" placeholder="请输入联系方式">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">提车日期：</label>
                                                <div class="col-sm-2 input-daterange input-group datepicker">
                                                    {if condition="!empty($info.get_time) && strlen($info.get_time)>0 && $info.get_time>1517414400"}
                                                    <input type="text" class="form-control" id="get_time" name="get_time"
                                                        value='{$info.get_time|date="Y-m-d",###}' placeholder="请输入提车日期">
                                                    {else/}
                                                    <input type="text" class="form-control" id="get_time" name="get_time"
                                                        value="" placeholder="请输入提车日期">
                                                    {/if}
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">租赁类型：</label>
                                                <div class="col-sm-6">
                                                    <select id="hire_mode" name="hire_mode" class="form-control"
                                                        required>
                                                        {foreach name="modes" item="item"}
                                                        {if condition="$item['id'] eq $info['hire_mode']"}
                                                        <option value="{$item.id}" ind="{$item.config_value}" selected="selected">
                                                            {$item.config_name}
                                                        </option>
                                                        {else/}
                                                        <option value="{$item.id}" ind="{$item.config_value}">
                                                            {$item.config_name}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">起租日期：</label>
                                                <div class="col-sm-2 input-daterange input-group datepicker">
                                                    <input type="text" class="form-control" id="start_time" name="start_time"
                                                        value='{$start_time|date="Y-m-d",###}' placeholder="请输入起租时间">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">租赁时长：</label>
                                                <div class="col-sm-6">
                                                    <select id="hire_timelen" name="hire_timelen" class="form-control"
                                                        required>
                                                        {foreach name="hire_timelens" item="v" key="k" }
                                                        {if condition="$k eq $info['hire_timelen']"}
                                                        <option value="{$k}" selected="selected">
                                                            {$v}
                                                        </option>
                                                        {else/}
                                                        <option value="{$k}">
                                                            {$v}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">终止日期：</label>
                                                <div class="col-sm-4">
                                                    <input type="text" class="form-control" readonly="readonly" id="end_time"
                                                        name="end_time" value='{$end_time}' placeholder="请输入终止日期">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">是否含保险：</label>
                                                <div class="col-sm-2">
                                                    <input type="checkbox" class="js-switch" name="has_insurance" value="1" {if condition="$info['has_insurance'] eq 1"}checked{/if} />
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">保险项目：</label>
                                                <div class="col-sm-6">
                                                    {foreach name="insurances" item="item"}
                                                    <div class="checkbox checkbox-success checkbox-inline">
                                                        <input type="checkbox" class="power_parent_id_52" value="{$item.id}" id="insurance_id_{$item.id}" name="insurance_id[]" {if condition="in_array($item['id'],$insuranceArr)"}checked{/if}>
                                                        <label for="insurance_id_{$item.id}">
                                                            {$item.name}
                                                        </label>
                                                    </div>
                                                    {/foreach}
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">付款方式：</label>
                                                <div class="col-sm-6">
                                                    <select id="pay_mode" name="pay_mode" class="form-control" required>
                                                        {foreach name="pay_modes" item="v" key="k" }
                                                        {if condition="$k eq $info['pay_mode']"}
                                                        <option value="{$k}" selected="selected">
                                                            {$v}
                                                        </option>
                                                        {else/}
                                                        <option value="{$k}">
                                                            {$v}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">付款时长：</label>
                                                <div class="col-sm-6">
                                                    <select id="pay_timelen" name="pay_timelen" class="form-control"
                                                        required>
                                                        {foreach name="pay_timelens" item="v" key="k" }
                                                        {if condition="$k eq $info['pay_timelen']"}
                                                        <option value="{$k}" selected="selected">
                                                            {$v}
                                                        </option>
                                                        {else/}
                                                        <option value="{$k}">
                                                            {$v}
                                                        </option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">下次续费日期：</label>
                                                <div class="col-sm-4">
                                                    <input type="text" class="form-control" readonly="readonly" id="renewal_time"
                                                        name="renewal_time" value='{$renewal_time}' placeholder="请输入下次续费日期">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">首付/押金：</label>
                                                <div class="col-sm-4">
                                                    <input type="text" class="form-control" readonly="readonly" id="deposit_price"
                                                        name="deposit_price" value='{$info.deposit_price}' placeholder="由进货商务政策决定">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">月租/月供：</label>
                                                <div class="col-sm-4">
                                                    <input type="text" class="form-control" readonly="readonly" id="hire_price"
                                                        name="hire_price" value='{$info.hire_price}' placeholder="由进货商务政策决定">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">全款：</label>
                                                <div class="col-sm-4">
                                                    <input type="text" class="form-control" readonly="readonly" id="total_amount"
                                                        name="total_amount" value='{$info.total_amount}' placeholder="由进货商务政策决定">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">其他费用：</label>
                                                <div class="col-sm-3">
                                                    <input type="text" id="other_amount" name="other_amount" class="form-control"
                                                        value="{$info.other_amount|round=2}" placeholder="由进货商务政策决定" readonly="readonly">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">折扣金额：</label>
                                                <div class="col-sm-3">
                                                    <input type="text" id="discount_amount" name="discount_amount"
                                                        class="form-control" value="{$info.discount_amount|round=2}"
                                                        placeholder="请输入折扣金额">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">总金额：</label>
                                                <div class="col-sm-3">
                                                    <input type="text" id="amount" name="amount" class="form-control"
                                                        value="{$info.amount|round=2}" placeholder="请输入总金额">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">订单补充说明：</label>
                                                <div class="col-sm-10">
                                                    <textarea class="form-control" id="remark" name="remark" rows="4">{$info.remark}</textarea>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">赠送期限：</label>
                                                <div class="col-sm-2 input-daterange input-group datepicker">
                                                    <input type="text" class="form-control" id="time_limit" name="time_limit"
                                                        value='{$time_limit|date="Y-m-d",###}' placeholder="请输入赠送期限">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">是否整单支付：</label>
                                                <div class="col-sm-2">
                                                    <input type="checkbox" class="js-switch1" name="is_payall" value="1" {if condition="$info['is_payall'] eq 1"}checked{/if} />
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable hide">
                                                <label class="col-sm-2 control-label">租金合计金额：</label>
                                                <div class="col-sm-3">
                                                    <input type="text" id="hire_amount" name="hire_amount" class="form-control"
                                                        value="{$info.hire_amount|round=2}" placeholder="请输入租金合计金额">
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">选择合同：</label>
                                                <div class="col-sm-6">
                                                    <select id="contract_id" name="contract_id" class="selectpicker show-tick form-control" data-live-search="true" required>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <!--服务相册-->
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">合同上传：</label>
                                                <div class="row contractBox" id="photoBox">
                                                    <div class="col-md-2 " style="text-align: center">
                                                        <a href="javascript:;" class="fa fa-plus-square-o" onclick="GetUploadify3(10,'','txt,xls,xlsx,doc,docx,pdf,ppt,jpg,png,gif,jpeg','contract_files','call_back2');"
                                                            style="width: 100%;font-size: 155px;"></a>
                                                    </div>
                                                    <div class="col-md-2 photoModel contractModel" style="display:none">
                                                        <div class="ibox-content text-center" style="border: 0;">
                                                            <div class="m-b-sm">
                                                                <img alt="contract_file" src="__PUBLIC__/dist/img/a8.jpg" style="max-width: 100%;max-height: 110px;">
                                                            </div>
                                                            <div class="text-center">
                                                                <a href="javascript:;" class="btn btn-xs btn-white delImage" data-path="">
                                                                    <i class="fa fa-trash-o"></i> 删除 </a>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    {foreach name="contract_file_list" item="item"}
                                                    <div class="col-md-2">
                                                        <div class="ibox-content text-center" style="border: 0;">
                                                            <div class="m-b-sm">
                                                                {if condition="in_array($item['file_ext'],$img_ext_list)"}
                                                                <img alt="contract_file" src="{$item.file_url}" style="max-width: 100%;max-height: 50px;">
                                                                {else/}
                                                                <img alt="contract_file" src="__PUBLIC__/dist/img/{$item.file_ext}.gif"
                                                                    style="max-width: 100%;max-height: 50px;">
                                                                {/if}
                                                            </div>
                                                            <div class="text-center">
                                                                <a href="javascript:;" class="btn btn-xs btn-white delImage" data-path="{$item.file_url}">
                                                                    <i class="fa fa-trash-o"></i> 删除 </a>
                                                            </div>
                                                        </div>
                                                        <input type="hidden" name="contract_files[]" value="{$item.file_url}">
                                                    </div>
                                                    {/foreach}
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                            <!--服务相册-->
                                            <div class="form-group draggable ui-draggable">
                                                <label class="col-sm-2 control-label">证件上传：</label>
                                                <div class="row certBox" id="photoBox">
                                                    <div class="col-md-2 " style="text-align: center">
                                                        <a href="javascript:;" class="fa fa-plus-square-o" onclick="GetUploadify3(10,'','txt,xls,xlsx,doc,docx,pdf,ppt,jpg,png,gif,jpeg','cert_files','call_back3');"
                                                            style="width: 100%;font-size: 155px;"></a>
                                                    </div>
                                                    <div class="col-md-2 photoModel certModel" style="display:none">
                                                        <div class="ibox-content text-center" style="border: 0;">
                                                            <div class="m-b-sm">
                                                                <img alt="cert_file" src="__PUBLIC__/dist/img/a8.jpg" style="max-width: 100%;max-height: 110px;">
                                                            </div>
                                                            <div class="text-center">
                                                                <a href="javascript:;" class="btn btn-xs btn-white delImage" data-path="">
                                                                    <i class="fa fa-trash-o"></i> 删除 </a>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    {foreach name="cert_file_list" item="item"}
                                                    <div class="col-md-2">
                                                        <div class="ibox-content text-center" style="border: 0;">
                                                            <div class="m-b-sm">
                                                                {if condition="in_array($item['file_ext'],$img_ext_list)"}
                                                                <img alt="cert_file" src="{$item.file_url}" style="max-width: 100%;max-height: 50px;">
                                                                {else/}
                                                                <img alt="cert_file" src="__PUBLIC__/dist/img/{$item.file_ext}.gif"
                                                                    style="max-width: 100%;max-height: 50px;">
                                                                {/if}
                                                            </div>
                                                            <div class="text-center">
                                                                <a href="javascript:;" class="btn btn-xs btn-white delImage" data-path="{$item.file_url}">
                                                                    <i class="fa fa-trash-o"></i> 删除 </a>
                                                            </div>
                                                        </div>
                                                        <input type="hidden" name="cert_files[]" value="{$item.file_url}">
                                                    </div>
                                                    {/foreach}
                                                </div>
                                            </div>
                                            <div class="hr-line-dashed"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable">
                                <div class="col-sm-12 col-sm-offset-3">
                                    <input type="hidden" name="hour_hire_amount" value="0">
                                    <input type="hidden" name="pledge_amount" value="0">
                                    <input type="hidden" name="deposit_amount" value="0">
                                    <input type="hidden" name="latefees_amount" value="0">
                                    <input type="hidden" name="first_amount" value="0">
                                    <input type="hidden" name="updator_id" value="{$info.updator_id}">
                                    <input type="hidden" name="update_time" value="{$info.update_time}">
                                    <input type="hidden" name="creator_id" value="{$info.creator_id}">
                                    <input type="hidden" name="create_time" value="{$info.create_time}">
                                    <input type="hidden" name="id" value="{$info.id}">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                    <button class="btn btn-white" type="button" onclick="javascript:history.go(-1);">取消</button>
                                </div>
                            </div>
                        </form>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/dist/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/dist/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
    <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
    <script src="__PUBLIC__/dist/js/plugins/switchery/switchery.js"></script>
    <script src="__PUBLIC__/dist/js/plugins/datapicker/bootstrap-datepicker.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/libs/global.js?rnd=12345678"> </script>
    <script src="__PUBLIC__/dist/js/bootstrap-select.js"></script>

    <script>
        Date.prototype.format = function (format) {
            var o = {
                "M+": this.getMonth() + 1, //month
                "d+": this.getDate(),    //day
                "h+": this.getHours(),   //hour
                "m+": this.getMinutes(), //minute
                "s+": this.getSeconds(), //second
                "q+": Math.floor((this.getMonth() + 3) / 3),  //quarter
                "S": this.getMilliseconds() //millisecond
            }
            if (/(y+)/.test(format)) {
                format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            }
            for (var k in o) {
                if (new RegExp("(" + k + ")").test(format)) {
                    format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
                }
            }
            return format;
        }
        var emle = document.querySelector('.js-switch');
        new Switchery(emle);
        var emle1 = document.querySelector('.js-switch1');
        new Switchery(emle1);
        emle.onchange = function () {
            if (emle.checked) {
                $('#insurance_id').removeAttr("disabled");
            } else {
                $('#insurance_id').val('0');
                $('#insurance_id').attr("disabled", true);
            }
        }
        function amount_sum_fun(){
            var car_id = $('#car_id').val(),hire_mode = $('#hire_mode').val();
            var hire_timelen = $('#hire_timelen').val();
            $.ajax({
                type: 'GET',
                url: "{:Url('OrderCar/ajax_amount_sum')}",
                data: { car_id: car_id, hire_mode: hire_mode, hire_timelen: hire_timelen, sale_mode: 1 },
                dataType: 'json',
                success: function (res) {
                    if(parseInt(res['status'])>0){
                        if(parseInt(res['hire_amount'])>0){
                            $('#hire_amount').val(res['hire_amount']);
                        }else{
                            $('#hire_amount').val('无');
                        }
                        $('#amount').val(res['amount']);
                        $('#deposit_price').val(res['deposit_price']);
                        $('#hire_price').val(res['hire_price']);
                        $('#total_amount').val(res['total_amount']);
                        $('#other_amount').val(res['other_amount']);
                    }else{
                        $('#hire_amount').val(0);
                        $('#amount').val(0);
                        $('#deposit_price').val(0);
                        $('#hire_price').val(0);
                        $('#total_amount').val(0);
                        $('#other_amount').val(0);
                    }
                }
            });
        }
        function select_hire_timelen() {
            var timelen = $('#hire_timelen').val();
            var start_time = $('#start_time').val();
            var paytimelen = $('#pay_timelen').val();
            var len = 0,paylen =0;
            switch (parseInt(timelen)) {
                case 0:
                len = 1;
                break;
                case 1:
                len = 3;
                break;
                case 2:
                len = 12;
                break;
                case 3:
                paylen = 36;
                break;
            }
            switch (parseInt(paytimelen)) {
                case 0:
                paylen = 1;
                break;
                case 1:
                paylen = 3;
                break;
                case 2:
                paylen = 12;
                break;
            }
            if (len > 0) {
                var start_date = new Date(start_time);
                var end_time = new Date(start_date.setMonth(start_date.getMonth()+len));
                $('#end_time').val(end_time.format('yyyy-MM-dd'));
            }
            if (paylen > 0) {
                var start_date = new Date(start_time);
                var renewal_time = new Date(start_date.setMonth(start_date.getMonth()+paylen));
                $('#renewal_time').val(renewal_time.format('yyyy-MM-dd'));
            }
        }
        $('#get_time').datepicker();
        $('#time_limit').datepicker();
        $('#start_time').datepicker().on('changeDate', function (e) {
            select_hire_timelen();
        });
        $('#hire_timelen').change(function(){
            select_hire_timelen();
            amount_sum_fun();
        });
        $('#pay_timelen').change(function(){
            select_hire_timelen();
        });
        function select_customer_fun() {
            var sel_item = $('#customer_id').find('option:selected');
            $('#contactor_name').val(sel_item.attr('data-master'));
            $('#tel').val(sel_item.attr('data-tel'));
            // $.ajax({
            //     type: 'GET',
            //     url: "{:Url('OrderCar/ajax_contactor_list')}",
            //     data: { customer_id: customer_id, contactor_id: '{$info.contactor_id}' },
            //     success: function (res) {
            //         $('#contactor_id').html(res);
            //     }
            // });
        }
        $('#customer_id').change(function () {
            select_customer_fun();
        });

        function select_store_fun() {
            var store_id = $('#store_id').val();
            $.ajax({
                type: 'GET',
                url: "{:Url('OrderCar/ajax_car_list')}",
                data: { store_id: store_id, order_id: '{$info.id}', car_id: '{$info.car_id}' },
                success: function (res) {
                    $('#car_id').html(res);
                    $('#car_id').selectpicker('refresh');
                    $('#car_id').selectpicker({
                        noneSelectedText: '请选择'
                    });
                    $('#car_id').on('changed.bs.select',function(e){
                        select_car_fun();
                        amount_sum_fun();
                    });
                    select_car_fun();
                }
            });
        }

        function select_car_fun(){
            var car_mode_name = $('#car_id option:selected').attr('data-mode-name');
            $('#car_mode_name').val(car_mode_name);
            amount_sum_fun();
        }

        $('#hire_mode').change(function(){
            select_hire_mode_fun();
            amount_sum_fun();
        });

        function select_hire_mode_fun() {
            var hire_mode = $('#hire_mode').val();
            $.ajax({
                type: 'GET',
                url: "{:Url('OrderCar/ajax_contract_list')}",
                data: { hire_mode: hire_mode, contract_id: '{$info.contract_id}' },
                success: function (res) {
                    $('#contract_id').html(res);
                    $('#contract_id').selectpicker('refresh');
                    $('#contract_id').selectpicker({
                        noneSelectedText: '请选择'
                    });
                }
            });
        }
        $('#store_id').change(function () {
            select_store_fun();
        });
        // 上传服务相册回调函数
        function call_back2(paths) {
            var img_ext_arr = ['.jpg', '.png', '.gif', '.jpeg'];
            for (var i = 0; i < paths.length; i++) {
                var clone = $('.contractModel').clone(true);
                var file_split = paths[i].split('.');
                var file_ext = '.' + file_split[file_split.length - 1];
                if ($.inArray(file_ext, img_ext_arr) > -1) {
                    clone.find('img').attr('src', paths[i]);
                } else {
                    clone.find('img').attr('src', '/public/dist/img/' + file_ext.replace('.','') + '.gif');
                }
                clone.find('.delImage').attr('data-path', paths[i]);
                clone.append('<input type="hidden" name="contract_files[]" value="' + paths[i] + '">');
                clone.removeClass('contractModel');
                $('.contractBox').append(clone.show());
            }
            if (paths.length > 0) {
                if ($('#contract_files-error').length > 0 && !$('#contract_files-error').hasClass('hide')) {
                    $('#contract_files-error').addClass('hide');
                }
            }
        }
        // 上传服务相册回调函数
        function call_back3(paths) {
            var img_ext_arr = ['.jpg', '.png', '.gif', '.jpeg'];
            for (var i = 0; i < paths.length; i++) {
                var clone = $('.certModel').clone(true);
                var file_split = paths[i].split('.');
                var file_ext = '.' + file_split[file_split.length - 1];
                if ($.inArray(file_ext, img_ext_arr) > -1) {
                    clone.find('img').attr('src', paths[i]);
                } else {
                    clone.find('img').attr('src', '/public/dist/img/' + file_ext.replace('.','') + '.gif');
                }
                clone.find('.delImage').attr('data-path', paths[i]);
                clone.append('<input type="hidden" name="cert_files[]" value="' + paths[i] + '">');
                clone.removeClass('certModel');
                $('.certBox').append(clone.show());
            }
            if (paths.length > 0) {
                if ($('#cert_files-error').length > 0 && !$('#cert_files-error').hasClass('hide')) {
                    $('#cert_files-error').addClass('hide');
                }
            }
        }
        $().ready(function () {
            select_hire_timelen();
            // 在键盘按下并释放及提交后验证提交表单
            $("#myform").validate({
                submitHandler: function (form) {
                    form.submit();
                },
                rules: {
                    order_no: {
                        required: true,
                        rangelength: [20, 32]
                    }
                },
                messages: {
                    order_no: {
                        required: "请输入订单编号",
                        rangelength: "订单编号长度不能小于 20 个字母"
                    }
                }
            });
            select_store_fun();
            select_customer_fun();
            select_hire_mode_fun();
        });
    </script>
</body>


<!-- Mirrored from www.zi-han.net/theme/hplus/table_data_tables.html by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 20 Jan 2016 14:20:02 GMT -->

</html>